// JavaScript Document

function CreateXMLHttpRequest()
{
	if (window.XMLHttpRequest )
	{
		return new XMLHttpRequest()
	}
	else if (window.ActiveXObject )
	{
		return new ActiveXObject("Microsoft.XMLHTTP")
	}
}

function PhanTrang(MaNguoiBan, page, loai)
{
	xmlHttp = CreateXMLHttpRequest();
	
	if (loai == 1)
	{
		xmlHttp.onreadystatechange = function()
		{
				if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
				{
					var kq = xmlHttp.responseText;
					document.getElementById("SuKienByMaNguoiBan").innerHTML = kq;
				}
		}
		
		var serverURL = "components/nguoiban/detail_sukien.php?MaNguoiBan="+MaNguoiBan+"&page="+page+"&ajax=1";
	}
	else
	{
		xmlHttp.onreadystatechange = function()
		{
				if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
				{
					var kq = xmlHttp.responseText;
					document.getElementById("SanPhamByMaNguoiBan").innerHTML = kq;
				}
		}
		
		var serverURL = "components/nguoiban/detail_sanpham.php?MaNguoiBan="+MaNguoiBan+"&page="+page+"&ajax=1";
	}

	
	serverURL += "&t" + new Date().getTime();
	
	xmlHttp.open("GET", serverURL, true);
	xmlHttp.send(null);
}

// quản lý tài khoản người mua ////////////////////////////////////////////////////////////////////////
function PhanTrangNguoiMua(page)
{
	xmlHttp = CreateXMLHttpRequest();

	xmlHttp.onreadystatechange = function()
	{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				var kq = xmlHttp.responseText;
				document.getElementById("ListNguoiMua").innerHTML = kq;
			}
	}
	
	var serverURL = "components/nguoiban/quanly_nguoimua.php?page="+page+"&ajax=1";

	serverURL += "&t" + new Date().getTime();
	
	xmlHttp.open("GET", serverURL, true);
	xmlHttp.send(null);
}